package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.SystemNotice;
import cn.wolfcode.trip.base.service.ISystemNoticeService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("systemnotices")
public class SystemNoticeController {
    @Autowired
    private ISystemNoticeService noticeService;
    @GetMapping("{userId}/count")
    public Integer getNoticeCount(@PathVariable Long userId){
        return noticeService.getNoticeCount(userId);
    }
    @GetMapping("{userId}/notice")
    public List<SystemNotice> getNotices(@PathVariable Long userId){
        System.out.println("---------");
        return noticeService.getNotices(userId);
    }
    @PutMapping("{id}/changeReadState")
    public void changeReadState(@PathVariable Long id){
        noticeService.changeReadState(id);
    }
}
